package org.jeecg.modules.workorder.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Description: 生产工单
 * @Date:   2021-09-09
 * @Version: V1.0
 */
@Data
@TableName("working_order")
@ApiModel(value="working_order对象", description="生产工单")
public class WorkingOrder implements Serializable {
	
    private static final long serialVersionUID = 1L;

	/** 主键 */
	@TableId(type = IdType.ASSIGN_ID)
	@ApiModelProperty(value = "主键")
	private java.lang.String id;

	/** 创建人 */
	@Excel(name = "创建人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
	@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
	@ApiModelProperty(value = "创建人")
	private java.lang.String createBy;

	/** 所属部门 */
	@Excel(name = "所属部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
	@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
	@ApiModelProperty(value = "所属部门")
	private java.lang.String sysOrgCode;

	/** 创建时间 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "创建时间")
	private java.util.Date createTime;

	/** 更新人 */
	@ApiModelProperty(value = "更新人")
	private java.lang.String updateBy;

	/** 更新时间 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "更新时间")
	private java.util.Date updateTime;

	/** 父工单号 */
	@Excel(name = "父工单ID", width = 15)
	@ApiModelProperty(value = "父工单ID")
	private java.lang.String pid;

	/** 是否有子工单 */
	@Excel(name = "是否有子工单", width = 15, dicCode = "yn")
	@Dict(dicCode = "yn")
	@ApiModelProperty(value = "是否有子工单")
	private java.lang.String hasChild;

	/** 工单号 */
	@Excel(name = "工单号", width = 15)
	@ApiModelProperty(value = "工单号")
	private java.lang.String workNum;

	/** 合并单的工单号和拆分页 */
	@Excel(name = "合并单的工单号和拆分页", width = 15)
	@ApiModelProperty(value = "合并单的工单号和拆分页")
	private java.lang.String mergedWorknumAndPn;

	/** 拆分页 */
	@Excel(name = "拆分页", width = 15)
	@ApiModelProperty(value = "拆分页")
	private java.lang.String pn;

	/** 工单类型 */
	@Excel(name = "工单类型", width = 15, dicCode = "work_order_type")
	@Dict(dicCode = "work_order_type")
	@ApiModelProperty(value = "工单类型")
	private java.lang.Integer workOrderType;

	/** 存货人 */
	@Excel(name = "存货人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
	@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
	@ApiModelProperty(value = "存货人")
	private java.lang.String storeBy;

	/** 存货部门 */
	@Excel(name = "存货部门", width = 15, dicText = "depart_name", dicCode = "org_code")
	@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
	@ApiModelProperty(value = "存货部门")
	private java.lang.String storeDept;

	/** 存货数量 */
	@Excel(name = "存货数量", width = 15)
	@ApiModelProperty(value = "存货数量")
	private java.lang.Integer count;

	/** 状态 */
	@Excel(name = "状态", width = 15, dicCode = "work_store_status")
	@Dict(dicCode = "work_store_status")
	@ApiModelProperty(value = "状态")
	private java.lang.Integer storeStatus;

	/** 是否拆过子单。0=否 1=是 */
	@Excel(name = "是否拆过子单", width = 15, dicCode = "yn")
	@Dict(dicCode = "yn")
	@ApiModelProperty(value = "是否被拆子单")
	private java.lang.Integer isSplited;

	/** 是否被合并。0=否 1=是 */
	@Excel(name = "是否被合并", width = 15, dicCode = "yn")
	@Dict(dicCode = "yn")
	@ApiModelProperty(value = "是否被合并")
	private java.lang.Integer isMerged;
	
	/** 开单日期 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "开单日期")
	private java.util.Date openWorkorderDate;
	
	/** 交货日期 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@ApiModelProperty(value = "交货日期")
	private java.util.Date deliveryDate;

	/** 备注 */
	@Excel(name = "备注", width = 15)
	@ApiModelProperty(value = "备注")
	private java.lang.String remark;
	
	/** 款号 */
	private java.lang.String styleCodeNum;
	
	/** 款名 */
	@Excel(name = "款名", width = 15, dictTable = "style_customer_info", dicText = "name", dicCode = "id")
	@Dict(dictTable = "style_customer_info", dicText = "name", dicCode = "id")
	private java.lang.String styleCusInfoId;

	/** 订单号 */
	@Excel(name = "订单号", width = 15, dictTable = "order_info", dicText = "code_num", dicCode = "id")
	@Dict(dictTable = "order_info", dicText = "code_num", dicCode = "id")
	private java.lang.String orderInfoId;

	/** 当前做货记录ID */
	private java.lang.String currWorkingOrderRecordId;
	
	/** 图片 */
	private byte[] styleImage;

	/** 图片 */
	private transient java.lang.String styleImageString;

	public byte[] getStyleImage() {
		if (styleImageString == null) {
			return null;
		}
		try {
			return styleImageString.getBytes("UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return null;
	}

	public String getStyleImageString() {
		if (styleImage == null || styleImage.length == 0) {
			return "";
		}
		try {
			return new String(styleImage, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return "";
	}
    
	/** 工单的做货跟踪记录集合 */
	@TableField(exist = false)
	private java.util.List<WorkingOrderRecord> workingOrderRecordList;
}
